function add0(m){return m<10?'0'+m:m }
function format(shijianchuo)
{
//shijianchuo是整数，否则要parseInt转换
var time = new Date(shijianchuo);
var y = time.getFullYear();
var m = time.getMonth()+1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
}
$(document).ready(function(){
	var rootPath = getRootPath();
	var phone = '';
	var submitDateFrom = '';
	var submitDateEnd = '';
	var startDateFrom = '';
	var startDateEnd = '';
	var askingPriceStatus = '';
	
	$.ajax({
		method : 'get',
		url : rootPath+'/wechat/api/askingPrice?phone='+phone+'&submitDateFrom='+submitDateFrom+'&submitDateEnd='+submitDateEnd+'&startDateFrom='+startDateFrom+'&startDateEnd='+startDateEnd+'&askingPriceStatus='+askingPriceStatus,
		error:function(XMLHttpRequest, ajaxOptions, thrownError){
			alert("连接服务器错误!");
		},
		success : function(resultData){
			
			var wholeHtml = '';
			
			$.each(resultData,function(askingpriceIndex,askingpriceObj){
				
				var askingpriceHtml = '';
				
				var askingPriceId = askingpriceObj.askingPriceId
				
				var color= '';
				
				if(askingpriceObj.status=='已报价'){
					color = '48ACED';
				}else if(askingpriceObj.status=='待报价'){
					color = 'F6304F';
				}else{
					color = 'C0C0C0';
				}
				
				askingpriceHtml = askingpriceHtml   + '<div class="panel panel-default">'
				  									+ '<a href="askingpriceinfor.html?askingPriceId='+askingPriceId+'" class="list-group-item clearfix">'
				  									+ '<div style="width:70%;float:left">'
				  									+ '<p style="font-family:黑体;font-size:15px">'+ askingpriceObj.packageCodeName + '</p>'
				  									+ '<small>' + format(askingpriceObj.createDate) + '</small>'
				  									+ '</div>'
				  									+ '<div style="width:30%;float:right;text-align:right">'
				  									+ '<span style="width:70%;float:right;font-family:黑体;font-size:13px;color:#'+ color +'">'+ askingpriceObj.status + '</span>'
				  									+ '<br><br><span style="float:right" class="glyphicon glyphicon-chevron-right"></span>'
				  									+ '</div>'
				  									+ '</a>'
				  									+ '</div>'
				
				wholeHtml += askingpriceHtml;
			});
			
			$("#aksingprice").append(wholeHtml);
		}
	});
})
